[PM-26292] tool: Add script to delete unused Localizable.strings entries#2464
[PM-26292] tool: Add script to delete unused Localizable.strings entries#2464KatherineInCode wants to merge 6 commits intomainfrom
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2464 +/- ##
==========================================
- Coverage 87.08% 85.95% -1.13%
==========================================
Files 1862 2092 +230
Lines 165404 180212 +14808
==========================================
+ Hits 144042 154904 +10862
- Misses 21362 25308 +3946 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f25e6b7 to
1b5766f
Compare
1b5766f to
688112f
Compare
688112f to
87d355a
Compare
Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the new |
| if args.dry_run: | ||
| with open(args.strings, encoding="utf-8") as f: | ||
| content = f.read() | ||
| import os |
There was a problem hiding this comment.
🎨 suggestion - moving inline imports to the top of the scripts, makes it easier to know in advance what the script is using. There's another in the test_delete_unused_strings.py file (import shutil).
|
|
||
|
|
||
| def _normalize_key(key: str) -> str: | ||
| """Normalize a ``.strings`` key for comparison against a SwiftGen identifier. |
There was a problem hiding this comment.
💭 Very personal take - given these scripts aren't for public distribution, these docstrings are blowing up line count without adding much, method name and the 3 comments above the regexps were enough for me at least.

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-26292
📔 Objective
This builds on #2412 by adding a module that finds unused strings and deletes them. I also did some refactoring of the strings file management into a separate python module.
I also ran the script, and it found 308 unused keys, many of which were identified in #2003. I'm not entirely sure why it's so many, especially of what seem like basic strings, though my guess is that some are used on Android, and a lot of them are detritus from MAUI or earlier that just never got cleaned up.
As noted in #2412, eventually we could have running these scripts be part of the CI process in some way, but currently these are still manual runs.